package cn.ml.springdemo.daYinJi;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestDaYinJi {
    public static void main(String[] args) {

        ApplicationContext ac = new ClassPathXmlApplicationContext("ac.xml");
        DaYinJi daYinJi = (DaYinJi) ac.getBean("daYinJi");
        DaYinJi daYinJi2 = (DaYinJi) ac.getBean("daYinJi2");
        //当使用获取类型时，xml中配置两个所以无法找到到底需要哪个，会报错
        /*DaYinJi daYinJi3 = ac.getBean(DaYinJi.class);
        daYinJi3.print("ssss");*/
        daYinJi.print("setter注(必须有set方法)/构造注入(必须有有参构造)");
        daYinJi2.print("使用p命名空间注入(必须有无参构造)");
        System.out.println(daYinJi == daYinJi2);

    }
}
